/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upf.grupE.interf;

/**
 *
 * @author Oscar
 */


    import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

/**
 *
 * @author Madhava Carrillo <madhava at me.com>
 */
public class TabComponent extends JPanel implements ActionListener {
    private JTabbedPane pane;
    /**
     *
     * @param title, name of the users
     * @param pane, panel where options are going to be applied
     */
    public TabComponent(String title, JTabbedPane pane) {
       int index;
        this.pane = pane;
        setOpaque(false);
        JLabel label = new JLabel(title);
   
        add(label);
        JButton button = new JButton("X");
        button.setContentAreaFilled(false);
        button.setBorderPainted(false);
         add(button);
        button.addActionListener(this);}
     
       
    

   /**
    *
    * @param e, cremove the panel
    */
   public void actionPerformed(ActionEvent e) {
        int i = pane.indexOfTabComponent(this);
        if (i != -1)
            pane.remove(i);
    }


}



